// widgets/GoodsDetailWidgets/GoodsDetailHeadWidget/GoodsDetailHeadWidget.js
//获取应用实例
const app = getApp()
const assetsAddress = app.globalData.global.assetsIp + '/' + app.globalData.global.assetsName;

Component({
  /**
   * 组件的属性列表
   */
  properties: {
    goods:{
      type: Object,
    },
    goodsSpecInfo: {
      type: Object,
    },
    goodsBanner: {
      type: Array,
      value: [], // 轮播图
    },
    goodsRecord: {
      type: Array,
      value: [], // 商品购买记录
    },
    areaName: {
      type: String,
      value: '', // 分区名称
    },
    countDownTime: {
      type: Number,
      value: 0, // 倒计时
    },
    hasBegin: {
      type: Boolean,
      value: false, // 秒杀是否开始
    },
    imgType: {
      type: String, // 图片类型
    }
  },

  /**
   * 组件的初始数据
   */
  data: {
    assetsAddress: assetsAddress,
    timeData: {},
  },

  /**
   * 组件的方法列表
   */
  methods: {
    onChange(e) {
      console.log(e.detail)
      this.setData({
        timeData: e.detail,
      });
    },
    showPic(e){
      let item = e.target.dataset.item||e.currentTarget.dataset.item;
      this.triggerEvent('showBannerPic',JSON.stringify(item))
    },
  }
})
